package com.sqx.modules.goods.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sqx.modules.goods.vo.GoodsVo;
import com.sqx.modules.goods.entity.Goods;
import com.baomidou.mybatisplus.extension.service.IService;
import com.sqx.common.utils.Result;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.sqx.modules.scFollow.entity.ScFollow;

import java.math.BigDecimal;

/**
 * 商品 服务类
 * @author wuChang
 * @since 2024-05-30
 */

public interface GoodsService extends IService<Goods> {
    /**
     * 新增或修改商品
     */
    Result saveGoods (Goods goods);

    /**
     * 获取改商品列表
     */
    IPage<Goods> getMyGoodsList(Integer page, Integer limit, Goods goods);

    Result updateStatus(Long userId, Long goodId);

    IPage<GoodsVo> getAdminGoodsList(Integer page, Integer limit, GoodsVo goodsVo);

    IPage<GoodsVo> getAdminRecycleGoodsList(Integer page, Integer limit, GoodsVo goodsVo);

    Result authGoods(Long goodId, Integer status, String authRemark);

    Result banGoods(Long goodId, String authRemark);

    IPage<GoodsVo> getGoodsList(Integer page, Integer limit, GoodsVo goodsVo);

    Result getGoodsById(Long goodId, Long loginUserId);
    Result getAppGoodsById(Long userId,Long goodId, Long loginUserId);

    /**
     * 根据经纬度获取当前经纬度下的商品列表
     */
    Result getGoodsByCoordinates(Long typeId,Integer pageNum,Integer pageSize,  GoodsVo goodsVo);

    /**
     * 根据名称查一级分类
     */
    Result selectTypeByName(String typeName);

    /**
     * 根据二级分类查品牌
     */
    Result selectBrandByTypeId(Long typeId,String brandName);

    /**
     * 查询该商品的新旧程度
     */
    Result selectNewOld();

    Result getGoodsIdBySpec(Long goodId);

    IPage<GoodsVo> getGoodsListByPrice(Integer page, Integer limit, GoodsVo goodsVo);

    IPage<GoodsVo> getGoodsListByLabel(Integer page, Integer limit, GoodsVo goodsVo);

    /**
     * 根据城市获取商品列表
     * @param page
     * @param limit
     * @param goodsVo
     * @return
     */
    IPage<GoodsVo> getGoodsListByCity(Integer page, Integer limit, GoodsVo goodsVo);

    /**
     * 根据一级分类查二级分类
     * @param typeId
     * @return
     */
    Result selectByType(Long typeId);

    /**
     * 选择是否置顶商品
     * @param userId
     * @param goodId
     * @return
     */
    Result isTopGoods(Long userId,Long goodId);

    Result adminIsTopGoods(Long goodId);

    /**
     * 搜索查询商品列表
     * @param page
     * @param limit
     * @param goodsVo
     * @return
     */
    IPage<GoodsVo> getGoodsBySearchList(Integer page, Integer limit, GoodsVo goodsVo);

    Result updateStatusByGoodId(Goods goods);

    Result selectByGoodId(Long goodId);

    boolean selectStockByGoodId(Long goodId,Integer buyNum);

    Result updateStockByGoodId(Long goodId,Integer buyNum);

    Result updateByStock(Goods goods);

    Result getGoodsByTypes(Integer page,Integer limit,String typeName);

    int selectByRecycleGoods(Long goodId, Integer status, BigDecimal totalPrice);
}
